import axios from 'axios'

let Axios = axios.create({
    baseURL : 'https://www.linweiqin.cn/api/public/v1/'
});

Axios.interceptors.request.use(function(config){
 // Do something before request is sent
    // Todo 将 auth_token 将它加到请求数据中
    return config;
  }, function (error) {
    // Do something with request error
    return Promise.reject(error);
});

Axios.interceptors.response.use(function(response){
       // Any status code that lie within the range of 2xx cause this function to trigger
    // Do something with response data
    return response.data;
},function(err){
     // Any status codes that falls outside the range of 2xx cause this function to trigger
    // Do something with response error
    return Promise.reject(err)
});

export default Axios